<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var addTwoNumbers = function (l1, l2) {
        if (!l1 && !l2) return 0;
        let arr1 = [], arr2 = []; str3 = [], res = [];
        while (l1) {
          arr1.unshift(l1.val);
          l1 = l1.next;
        }
        while (l2) {
          arr2.unshift(l2.val);
          l2 = l2.next;
        }
        console.log(arr1);
        console.log(arr2);
        str3 = arr1.join('') + arr2.join('')
        console.log(str3);
        res = str3.split('').reverse();
      };
      console.log(addTwoNumbers([[2, 4, 3]],[[5, 6, 4]]));
  </script>
</body>
</html>